﻿@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title></title>
    <script src="~/Script/jquery.min.js"></script>
    <script src="~/Script/bootstrap.min.js"></script>
    <script src="~/Script/template.js"></script>
    <script src="~/Script/bootstrap-table.min.js"></script>
    <script src="~/Script/bootstrap-table-zh-CN.min.js"></script>
    <link href="~/Css/bootstrap.min.css" rel="stylesheet" />
    <link href="~/Css/bootstrap-table.min.css" rel="stylesheet" />
    <link href="~/Css/animate.min.css" rel="stylesheet" />
    <link href="~/Css/style.min.css" rel="stylesheet" />
</head>
<body>
    <div class="panel-body" style="padding-bottom:0px;">
        <div class="panel panel-default">
            <div class="panel-heading">查询条件</div>
            <div class="panel-body">
                <form id="formSearch" class="form-horizontal">
                    <div class="form-group" style="margin-top:15px">
                        <label class="control-label col-sm-1" for="txt_search_departmentname">部门名称</label>
                        <div class="col-sm-3">
                            <input type="text" class="form-control" id="txt_search_departmentname">
                        </div>
                        <label class="control-label col-sm-1" for="txt_search_statu">状态</label>
                        <div class="col-sm-3">
                            <input type="text" class="form-control" id="txt_search_statu">
                        </div>
                        <div class="col-sm-4" style="text-align:left;">
                            <button type="button" style="margin-left:50px" id="btn_query" class="btn btn-primary">查询</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>

        <div id="toolbar" class="btn-group">
            <button id="btn_add" type="button" class="btn btn-default">
                <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>新增
            </button>
            <button id="btn_edit" type="button" class="btn btn-default">
                <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>修改
            </button>
            <button id="btn_delete" type="button" class="btn btn-default">
                <span class="glyphicon glyphicon-remove" aria-hidden="true"></span>删除
            </button>
        </div>

        <table id="tb_departments"></table>

        <!-- 人员信息编辑 -->
        <div class="modal inmodal" id="myModal" tabindex="-1" role="dialog" aria-hidden="true">
            <div class="modal-dialog transfer">
                <div class="modal-content animated bounceInRight">
                    <div class="modal-title modal-border-b">
                        <div class="col-sm-3" style="padding-right: 0px;">
                            <p class="modal-title-text" style="text-align: left;">人员信息查看</p>
                        </div>
                        <div class="col-sm-7" style="padding-left: 0px;padding-right: 0px;">
                        </div>
                        <div class="col-sm-2">
                            <div class="modal-close close" data-dismiss="modal">关闭</div>
                        </div>
                    </div>
                    <div style="max-height: 700px;overflow-y: scroll;">
                        <div class="col-sm-12" style="height:40px;line-height:40px;background-color:#F5F5F5;">
                            <span class="col-sm-offset-1"><b>身份证信息</b></span>
                        </div>
                        <div class="col-sm-12">
                            <div class="modal-context">
                                <div class="col-sm-6">
                                    <div class="row" style="height:32px;line-height:32px;margin-bottom:10px;">
                                        <div class="col-sm-4" style="text-align:right;vertical-align:middle;">
                                            姓名：
                                        </div>
                                        <div class="col-sm-8" style="vertical-align:middle;">
                                            <input type="text" class="form-control" value="闻照卫">
                                        </div>
                                    </div>
                                    <div class="row" style="height:32px;line-height:32px;margin-bottom:10px;">
                                        <div class="col-sm-4" style="text-align:right;vertical-align:middle;">
                                            性别：
                                        </div>
                                        <div class="col-sm-8" style="vertical-align:middle;">
                                            <input type="text" class="form-control" value="男">
                                        </div>
                                    </div>
                                    <div class="row" style="height:32px;line-height:32px;margin-bottom:10px;">
                                        <div class="col-sm-4" style="text-align:right;vertical-align:middle;">
                                            民族：
                                        </div>
                                        <div class="col-sm-8" style="vertical-align:middle;">
                                            <input type="text" class="form-control" value="汉">
                                        </div>
                                    </div>
                                    <div class="row" style="height:32px;line-height:32px;margin-bottom:10px;">
                                        <div class="col-sm-4" style="text-align:right;vertical-align:middle;">
                                            出生日期：
                                        </div>
                                        <div class="col-sm-8" style="vertical-align:middle;">
                                            <input type="text" class="form-control" value="1985-09-17">
                                        </div>
                                    </div>
                                    <div class="row" style="height:32px;line-height:32px;margin-bottom:10px;">
                                        <div class="col-sm-4" style="text-align:right;vertical-align:middle;">
                                            身份证号：
                                        </div>
                                        <div class="col-sm-8" style="vertical-align:middle;">
                                            <input type="text" class="form-control" value="610403199308791325">
                                        </div>
                                    </div>
                                </div>
                                <div class="col-sm-6">
                                    <img src="http://tower-img.1357.cn/file/2017-08-21/540644510301420.jpg" alt="人员照片" style="width:102px;height:120px;">
                                </div>
                                <div class="col-sm-12">
                                    <div class="row" style="height:32px;line-height:32px;margin-bottom:10px;">
                                        <div class="col-sm-2" style="text-align:right;vertical-align:middle;">
                                            住址：
                                        </div>
                                        <div class="col-sm-8" style="vertical-align:middle;">
                                            <input type="text" class="form-control" value="陕西省西安市雁塔区太白南路168号">
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="col-sm-12" style="height:40px;line-height:40px;background-color:#F5F5F5;">
                            <span class="col-sm-offset-1"><b>基本信息</b></span>
                        </div>
                        <div class="col-sm-12">
                            <div class="modal-context">
                                <div class="col-sm-6">
                                    <div class="row" style="height:32px;line-height:32px;margin-bottom:10px;">
                                        <div class="col-sm-4" style="text-align:right;vertical-align:middle;">
                                            紧急联系人：
                                        </div>
                                        <div class="col-sm-8" style="vertical-align:middle;">
                                            <input type="text" class="form-control" value="王五">
                                        </div>
                                    </div>
                                    <div class="row" style="height:32px;line-height:32px;margin-bottom:10px;">
                                        <div class="col-sm-4" style="text-align:right;vertical-align:middle;">
                                            工种：
                                        </div>
                                        <div class="select_type col-sm-8" style="white-space: nowrap;">
                                            <span class="select_content">
                                                <select class="form-control" name="account">
                                                    <option>全部</option>
                                                    <option>水电工</option>
                                                    <option>信号工</option>
                                                    <option>塔机司机</option>
                                                </select>
                                            </span>
                                        </div>
                                    </div>
                                    <div class="row" style="height:32px;line-height:32px;margin-bottom:10px;">
                                        <div class="col-sm-4" style="text-align:right;vertical-align:middle;">
                                            联系电话：
                                        </div>
                                        <div class="col-sm-8" style="vertical-align:middle;">
                                            <input type="text" class="form-control" value="18975474681">
                                        </div>
                                    </div>
                                </div>
                                <div class="col-sm-6">
                                    <div class="row" style="height:32px;line-height:32px;margin-bottom:10px;">
                                        <div class="col-sm-4" style="text-align:right;vertical-align:middle;">
                                            紧急联系人电话：
                                        </div>
                                        <div class="col-sm-8" style="vertical-align:middle;">
                                            <input type="text" class="form-control" value="13459876418">
                                        </div>
                                    </div>
                                    <div class="row" style="height:32px;line-height:32px;margin-bottom:10px;">
                                        <div class="col-sm-4" style="text-align:right;vertical-align:middle;">
                                            分包单位：
                                        </div>
                                        <div class="select_type col-sm-8" style="white-space: nowrap;">
                                            <span class="select_content">
                                                <select class="form-control" name="account">
                                                    <option>全部</option>
                                                    <option>分包单位一</option>
                                                    <option>分包单位二</option>
                                                    <option>分包单位三</option>
                                                </select>
                                            </span>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="col-sm-12" style="height:40px;line-height:40px;background-color:#F5F5F5;">
                            <span class="col-sm-offset-1"><b>证件信息</b></span>
                        </div>
                        <div class="col-sm-12">
                            <div class="modal-context">
                                <div class="col-sm-6">
                                    <div class="row" style="height:32px;line-height:32px;margin-bottom:10px;">
                                        <div class="col-sm-4" style="text-align:right;vertical-align:middle;">
                                            证件编号：
                                        </div>
                                        <div class="col-sm-8" style="vertical-align:middle;">
                                            <input type="text" class="form-control" value="NC4376879060">
                                        </div>
                                    </div>
                                    <div class="row" style="height:32px;line-height:32px;margin-bottom:10px;">
                                        <div class="col-sm-4" style="text-align:right;vertical-align:middle;">
                                            证件有效期：
                                        </div>
                                        <div class="col-sm-8" style="vertical-align:middle;">
                                            <input type="text" class="form-control" value="2017-08-14"> --- <input type="text" class="form-control" value="2018-03-14">
                                        </div>
                                    </div>
                                </div>
                                <div class="col-sm-6">
                                    <img src="http://tower.1357.cn/files/20170724/small_file_59754f325cea9.jpg" alt="上传证件照" style="width:102px;height:120px;">
                                    <img src="http://tower.1357.cn/files/20170724/small_file_59754f363c767.jpg" alt="证件照截图" style="width:102px;height:120px;">
                                </div>
                            </div>
                        </div>
                        <div class="modal-footer" style="text-align: center;clear: both;">
                            <button type="button" class="btn btn-edit">提交</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <!-- 人员信息查看 -->
        <div class="modal inmodal" id="myModal1" tabindex="-1" role="dialog" aria-hidden="true">
            <div class="modal-dialog transfer">
                <div class="modal-content animated bounceInRight">
                    <div class="modal-title modal-border-b">
                        <div class="col-sm-3" style="padding-right: 0px;">
                            <p class="modal-title-text" style="text-align: left;">人员信息查看</p>
                        </div>
                        <div class="col-sm-7" style="padding-left: 0px;padding-right: 0px;">
                        </div>
                        <div class="col-sm-2">
                            <div class="modal-close close" data-dismiss="modal">关闭</div>
                        </div>
                    </div>
                    <div style="max-height: 700px;overflow-y: scroll;">
                        <div class="col-sm-12" style="height:40px;line-height:40px;background-color:#F5F5F5;">
                            <span class="col-sm-offset-1"><b>身份证信息</b></span>
                        </div>
                        <div class="col-sm-12">
                            <div class="modal-context">
                                <div class="col-sm-6">
                                    <div class="row" style="height:32px;line-height:32px;">
                                        <div class="col-sm-4" style="text-align:right;">
                                            姓名：
                                        </div>
                                        <div>
                                            闻照卫
                                        </div>
                                    </div>
                                    <div class="row" style="height:32px;line-height:32px;">
                                        <div class="col-sm-4" style="text-align:right;">
                                            性别：
                                        </div>
                                        <div>
                                            男
                                        </div>
                                    </div>
                                    <div class="row" style="height:32px;line-height:32px;">
                                        <div class="col-sm-4" style="text-align:right;">
                                            民族：
                                        </div>
                                        <div>
                                            汉
                                        </div>
                                    </div>
                                    <div class="row" style="height:32px;line-height:32px;">
                                        <div class="col-sm-4" style="text-align:right;">
                                            出生日期：
                                        </div>
                                        <div>
                                            1985-09-17
                                        </div>
                                    </div>
                                </div>
                                <div class="col-sm-6">
                                    <img src="http://tower-img.1357.cn/file/2017-08-21/540644510301420.jpg" alt="人员照片" style="width:102px;height:120px;">
                                </div>
                                <div class="col-sm-12">
                                    <div class="row" style="height:32px;line-height:32px;">
                                        <div class="col-sm-2" style="text-align:right;">
                                            身份证号：
                                        </div>
                                        <div>
                                            610403199308791325
                                        </div>
                                    </div>
                                    <div class="row" style="height:32px;line-height:32px;">
                                        <div class="col-sm-2" style="text-align:right;">
                                            住址：
                                        </div>
                                        <div>
                                            陕西省西安市雁塔区太白南路168号
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="col-sm-12" style="height:40px;line-height:40px;background-color:#F5F5F5;">
                            <span class="col-sm-offset-1"><b>基本信息</b></span>
                        </div>
                        <div class="col-sm-12">
                            <div class="modal-context">
                                <div class="col-sm-6">
                                    <div class="row" style="height:32px;line-height:32px;">
                                        <div class="col-sm-4" style="text-align:right;">
                                            人员信息：
                                        </div>
                                        <div>
                                            在场
                                        </div>
                                    </div>
                                    <div class="row" style="height:32px;line-height:32px;">
                                        <div class="col-sm-4" style="text-align:right;">
                                            紧急联系人：
                                        </div>
                                        <div>
                                            李四
                                        </div>
                                    </div>
                                    <div class="row" style="height:32px;line-height:32px;">
                                        <div class="col-sm-4" style="text-align:right;">
                                            工种：
                                        </div>
                                        <div>
                                            塔机司机
                                        </div>
                                    </div>
                                    <div class="row" style="height:32px;line-height:32px;">
                                        <div class="col-sm-4" style="text-align:right;">
                                            分包单位：
                                        </div>
                                        <div>
                                            陕西华筑建筑公司
                                        </div>
                                    </div>
                                </div>
                                <div class="col-sm-6">
                                    <div class="row" style="height:32px;line-height:32px;">
                                        <div class="col-sm-4" style="text-align:right;">
                                            联系电话：
                                        </div>
                                        <div>
                                            13487954821
                                        </div>
                                    </div>
                                    <div class="row" style="height:32px;line-height:32px;">
                                        <div class="col-sm-4" style="text-align:right;">
                                            紧急联系人电话：
                                        </div>
                                        <div>
                                            18364978449
                                        </div>
                                    </div>
                                    <div class="row" style="height:32px;line-height:32px;">
                                        <div class="col-sm-4" style="text-align:right;">
                                            年龄：
                                        </div>
                                        <div>
                                            26
                                        </div>
                                    </div>
                                    <div class="row" style="height:32px;line-height:32px;">
                                        <div class="col-sm-4" style="text-align:right;">
                                            单位电话：
                                        </div>
                                        <div>
                                            13469758467
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="col-sm-12" style="height:40px;line-height:40px;background-color:#F5F5F5;">
                            <span class="col-sm-offset-1"><b>证件信息</b></span>
                        </div>
                        <div class="col-sm-12">
                            <div class="modal-context">
                                <div class="col-sm-6">
                                    <div class="row" style="height:32px;line-height:32px;">
                                        <div class="col-sm-4" style="text-align:right;">
                                            证件编号：
                                        </div>
                                        <div>
                                            NC4376879060
                                        </div>
                                    </div>
                                    <div class="row" style="height:32px;line-height:32px;">
                                        <div class="col-sm-4" style="text-align:right;">
                                            证件有效期：
                                        </div>
                                        <div>
                                            <span>2017-03-10</span>-<span>2018-12-10</span>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-sm-6">
                                    <img src="http://tower.1357.cn/files/20170724/small_file_59754f325cea9.jpg" alt="上传证件照" style="width:102px;height:120px;">
                                    <img src="http://tower.1357.cn/files/20170724/small_file_59754f363c767.jpg" alt="证件照截图" style="width:102px;height:120px;">
                                </div>
                            </div>
                        </div>
                        <div class="col-sm-12" style="height:40px;line-height:40px;background-color:#F5F5F5;">
                            <span class="col-sm-offset-1"><b>识别信息</b></span>
                        </div>
                        <div class="col-sm-12">
                            <div class="modal-context">
                                <div class="col-sm-6">
                                    <div class="row" style="height:32px;line-height:32px;">
                                        <div class="col-sm-4" style="text-align:right;">
                                            指纹信息：
                                        </div>
                                        <div>
                                            <span class="btn btn-xs btn-outline btn-warning">未录入</span>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-sm-6">
                                    <div class="row" style="height:32px;line-height:32px;">
                                        <div class="col-sm-4" style="text-align:right;">
                                            录入时间：
                                        </div>
                                        <div>
                                            2017-09-13
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="modal-footer" style="text-align: center;clear: both;">
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script type="text/html" id="userInfoteml">
        <span class="f-l" style="width:80px;height:96px;vertical-align:middle;margin-right:10px;">
            <img src="{{Image}}" alt="人员照片" style="width:80px;height:96px;">
        </span>
        <ul style="display:inline-block;text-align: left;vertical-align:middle;">
            <li style="height:32px;line-height:32px;">
                <span>姓名：{{Name}}</span>
                <span class="btn btn-xs btn-outline btn-primary" style="margin-left:20px;">
                    {{if Status==0}}
                    无效
                    {{else if Status==1}}
                    有效
                    {{/if}}
                </span>
            </li>
            <li style="height:32px;line-height:32px;">
                性别：
                {{if Gender==0}}
                男
                {{else if Gender==1}}
                女
                {{/if}}
            </li>
            <li style="height:32px;line-height:32px;">
                身份证号：{{IdCard}}
            </li>
        </ul>
    </script>

    <script type="text/html" id="temp2">
        <div>
            <ul>
                {{each contents}}
                <li>{{$value.content}}</li>
                {{/each}}
            </ul>
        </div>
    </script>

    <script type="text/html" id="temp1">
        {{each list}}
        <div>
            <h2>{{$value.title}}</h2>
            {{include 'temp2' $value.a}}
        </div>
        {{/each}}
    </script>




    <script type="text/javascript">
        $(function () {
            Init();
            
            //1.初始化Table
            var oTable = new TableInit();
            oTable.Init();

            //2.初始化Button的点击事件
            var oButtonInit = new ButtonInit();
            oButtonInit.Init();
        });

        var Init = function () {
            var data = {
                list: [
                    {
                        title: "这是一个测试标题1",
                        a: {
                            contents: [
                                { "content": "这是一段内容1" },
                                { "content": "这是一段内容1" },
                                { "content": "这是一段内容1" }
                            ]
                        }
                    },
                    {
                        title: "这是一个测试标题2",
                        a: {
                            contents: [
                                { "content": "这是一段内容2" },
                                { "content": "这是一段内容2" },
                                { "content": "这是一段内容2" }
                            ]
                        }
                    }
                ]
            };

            var html = template('temp1', data);
            $("#main").html(html);
        }


        var TableInit = function () {
            var oTableInit = new Object();
            //初始化Table
            oTableInit.Init = function () {
                $('#tb_departments').bootstrapTable({
                    url: '/Home/GetUserList2',         //请求后台的URL（*）
                    method: 'get',                      //请求方式（*）
                    toolbar: '#toolbar',                //工具按钮用哪个容器
                    striped: true,                      //是否显示行间隔色
                    cache: false,                       //是否使用缓存，默认为true，所以一般情况下需要设置一下这个属性（*）
                    pagination: true,                   //是否显示分页（*）
                    sortable: false,                     //是否启用排序
                    sortOrder: "asc",                   //排序方式
                    queryParams: oTableInit.queryParams,//传递参数（*）
                    sidePagination: "server",           //分页方式：client客户端分页，server服务端分页（*）
                    pageNumber: 1,                       //初始化加载第一页，默认第一页
                    pageSize: 10,                       //每页的记录行数（*）
                    pageList: [10, 25, 50, 100],        //可供选择的每页的行数（*）
                    search: false,                       //是否显示表格搜索，此搜索是客户端搜索，不会进服务端，所以，个人感觉意义不大
                    strictSearch: true,
                    showColumns: true,                  //是否显示所有的列
                    showRefresh: true,                  //是否显示刷新按钮
                    minimumCountColumns: 1,             //最少允许的列数
                    clickToSelect: true,                //是否启用点击选中行
                    height: 500,                        //行高，如果没有设置height属性，表格自动根据记录条数觉得表格高度
                    uniqueId: "ID",                     //每一行的唯一标识，一般为主键列
                    showToggle: true,                    //是否显示详细视图和列表视图的切换按钮
                    cardView: false,                    //是否显示详细视图
                    detailView: false,                   //是否显示父子表
                    columns: [{
                        checkbox: true
                    }, {
                        field: 'Name',
                        title: '姓名',
                        formatter: function (data, row, index) {
                            return template("userInfoteml", { Image: row.Image, Name: row.Name, Gender: row.Gender, Age: row.Age, Status: row.Status, IdCard: row.IdCard });
                        }
                    }, {
                        field: 'Gender',
                        title: '性别',
                        formatter: function (data, type, row) {
                            if (data == 1)
                                return '女';
                            else
                                return '男';

                        }
                    }, {
                        field: 'Age',
                        title: '年龄'
                    }, {
                        field: 'Remark',
                        title: '备注'
                    },
                    {
                        field: 'Id',
                        title: '备注',
                        formatter: function (value, row, index) {
                            var html = '<a class="btn btn-detail  btn-sm radius" data-title="查看"  data-toggle="modal" onclick="edit_user_info(\'' + value + '\');">查看</a>';
                            return html;
                        }
                    }, ]
                });
            };

            //得到查询的参数
            oTableInit.queryParams = function (params) {
                var temp = {   //这里的键的名字和控制器的变量名必须一直，这边改动，控制器也需要改成一样的
                    //limit: params.limit,   //页面大小
                    //offset: params.offset,  //页码
                    //departmentname: $("#txt_search_departmentname").val(),
                    //statu: $("#txt_search_statu").val()
                };
                return temp;
            };
            return oTableInit;
        };


        var ButtonInit = function () {
            var oInit = new Object();
            var postdata = {};

            oInit.Init = function () {
                $("#btn_add").click(function () {
                    $("#myModalLabel").text("新增");
                    $("#myModal").find(".form-control").val("");
                    $('#myModal').modal()

                    postdata.DEPARTMENT_ID = "";
                });

                $("#btn_edit").click(function () {
                    var arrselections = $("#tb_departments").bootstrapTable('getSelections');
                    if (arrselections.length > 1) {
                        toastr.warning('只能选择一行进行编辑');

                        return;
                    }
                    if (arrselections.length <= 0) {
                        toastr.warning('请选择有效数据');

                        return;
                    }
                    $("#myModalLabel").text("编辑");
                    $("#txt_departmentname").val(arrselections[0].DEPARTMENT_NAME);
                    $("#txt_parentdepartment").val(arrselections[0].PARENT_ID);
                    $("#txt_departmentlevel").val(arrselections[0].DEPARTMENT_LEVEL);
                    $("#txt_statu").val(arrselections[0].STATUS);

                    postdata.DEPARTMENT_ID = arrselections[0].DEPARTMENT_ID;
                    $('#myModal').modal();
                });

                $("#btn_delete").click(function () {
                    var arrselections = $("#tb_departments").bootstrapTable('getSelections');
                    if (arrselections.length <= 0) {
                        toastr.warning('请选择有效数据');
                        return;
                    }

                    Ewin.confirm({ message: "确认要删除选择的数据吗？" }).on(function (e) {
                        if (!e) {
                            return;
                        }
                        $.ajax({
                            type: "post",
                            url: "/Home/Delete",
                            data: { "": JSON.stringify(arrselections) },
                            success: function (data, status) {
                                if (status == "success") {
                                    toastr.success('提交数据成功');
                                    $("#tb_departments").bootstrapTable('refresh');
                                }
                            },
                            error: function () {
                                toastr.error('Error');
                            },
                            complete: function () {

                            }

                        });
                    });
                });

                $("#btn_submit").click(function () {
                    postdata.DEPARTMENT_NAME = $("#txt_departmentname").val();
                    postdata.PARENT_ID = $("#txt_parentdepartment").val();
                    postdata.DEPARTMENT_LEVEL = $("#txt_departmentlevel").val();
                    postdata.STATUS = $("#txt_statu").val();
                    $.ajax({
                        type: "post",
                        url: "/Home/GetEdit",
                        data: { "": JSON.stringify(postdata) },
                        success: function (data, status) {
                            if (status == "success") {
                                toastr.success('提交数据成功');
                                $("#tb_departments").bootstrapTable('refresh');
                            }
                        },
                        error: function () {
                            toastr.error('Error');
                        },
                        complete: function () {

                        }

                    });
                });

                $("#btn_query").click(function () {
                    $("#tb_departments").bootstrapTable('refresh');
                });
            };

            return oInit;
        };
    </script>
</body>
</html>
